package com.metaapp.image.repo

import com.metaapp.image.data.Image
import com.metaapp.image.api.ImageApi
import io.reactivex.Flowable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * Created by huangshengsen on 2020/8/11.
 */
class ImageRepository(private val api: ImageApi) {

    fun getImageList(q: String, sn: Int, pn: Int): Flowable<List<Image>> {
        return api.getList(q, sn, pn)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .map {
                it.list
            }
    }
}